package com.geek.proxy.jdkproxy;

import com.geek.proxy.entity.Singer;
import com.geek.proxy.entity.impl.TestSinger;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class ProxyTest {

    public static void main(String[] args) {
        Singer singer = new TestSinger();
        InvocationHandler handler = new MyHandler(singer);
        Singer proxy = (Singer)Proxy.newProxyInstance(Singer.class.getClassLoader(), new Class[]{Singer.class}, handler);
        proxy.sing();
    }

}
